{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Starter notebook for working with daily S&P 500 component data\n",
    "\n",
    "S&P 500 tickers from https://en.wikipedia.org/wiki/List_of_S%26P_500_companies with `BRK.B` and `BF.B` tickers changed to Yahoo Finance format. Data pulled using\n",
    "\n",
    "```python\n",
    "df = pdr.DataReader(tickers, start='2019-12-31', data_source='yahoo')\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Standard Python imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import statsmodels.api as sm\n",
    "import statsmodels.formula.api as smf"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Read saved data from CSV"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "DatetimeIndex: 467 entries, 2019-12-31 to 2021-11-04\n",
      "Columns: 3030 entries, ('Adj Close', 'MMM') to ('Volume', 'ZTS')\n",
      "dtypes: float64(3030)\n",
      "memory usage: 10.8 MB\n"
     ]
    }
   ],
   "source": [
    "df = pd.read_csv(r'../data/sp500yahoofinance.csv', index_col=[0], header=[0,1], parse_dates=True)\n",
    "df.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "758146b731c3fd8b39ea7cab27c121b86244c5bbc1f629f2f080e03f5074f425"
  },
  "kernelspec": {
   "display_name": "Python 3.9.4 64-bit ('fdap': conda)",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.4"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
